package com.wf.controller;

import com.wf.dao.UserDao;
import com.wf.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.web.bind.annotation.*;

/**
 * Created by wufei on 2017/6/2.
 */
@RestController
public class UserController {

    @Autowired
    UserDao userDao;

    @GetMapping("/user/{id}")
    public User findById(@PathVariable Long id){
        return userDao.findOne(id);
    }

    @PostMapping("/user/save")
    public int save(@ModelAttribute User user){
        userDao.save(user);
        return 1;
    }
}
